// import TerrainClipPlan from '../lib/TerrainClipPlan'
export default {
    mounted() {
        this.$nextTick(() => {
            this.creatTERR()
        })
    },
    methods: {
        creatTERR() {
            var terrainExaggeration = 1
            var terrainExaggerationRelativeHeight = 1
            var terrainProvider = new Cesium.CesiumTerrainProvider({
                url: `${mapConfig.tilesUrlPre}/terrain/MbIRplMx` // 125
            })
            terrainProvider.readyPromise.then(() => {
                this.$viewer.scene.terrainProvider = terrainProvider
                this.$viewer.scene.globe.terrainExaggeration = terrainExaggeration
                this.$viewer.scene.globe.terrainExaggerationRelativeHeight = terrainExaggerationRelativeHeight
                console.log(this.$viewer.scene.terrainProvider.availability)
            })

            // setTimeout(() => {
            //     console.log(this.$viewer.scene.terrainProvider.availability)
            //     if (!this.$viewer.scene.terrainProvider.availability) {
            //         this.$viewer.scene.terrainProvider = terrainProvider

            //         this.$viewer.scene.globe.terrainExaggeration = terrainExaggeration
            //         this.$viewer.scene.globe.terrainExaggerationRelativeHeight = terrainExaggerationRelativeHeight
            //     }

            //     this.$viewer.scene.globe.terrainExaggeration = terrainExaggeration
            //     this.$viewer.scene.globe.terrainExaggerationRelativeHeight = terrainExaggerationRelativeHeight
            // }, 5000)
        },
        clearTERR() {
            this.$viewer.scene.terrainProvider = new Cesium.EllipsoidTerrainProvider({})
            // this.$viewer.scene.terrainProvider = Cesium.createWorldTerrain()
        }
    }
}
